#pragma once
#include <vector>

using namespace std;

namespace rotateMatrix
{
	class Solution {
	public:
		void rotateMatrix(vector<vector<int>>& matrix) {
			int length = matrix.size();
			int up = 0;
			int down = length - 1;
			int tmp;
			while (up < down)
			{
				for (int i = 0; i < length; i++)
				{
					tmp = matrix[up][i];
					matrix[up][i] = matrix[down][i];
					matrix[down][i] = tmp;
				}
				up++;
				down--;
			}
			for (int i = 0; i < length; i++)
			{
				for (int j = i + 1; j < length; j++)
				{
					tmp = matrix[i][j];
					matrix[i][j] = matrix[j][i];
					matrix[j][i] = tmp;
				}
			}
		}
	};
}